﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Core.Base;

namespace Components
{
    public partial class SGVToolbar : UserControl, ISGVControl
    {
        public BaseModule module;
        public BaseEntity entity;

        public SGVToolbar()
        {
            InitializeComponent();
        }

        #region Event
        private void PRINT_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (module != null)
                module.ActionPrint();
        }

        private void HISTORY_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.History();
        }

        public void RegisterModule(BaseModule _module)
        {
            if (_module != null)
            {
                this.module = _module;
                this.entity = _module.entity;
            }
        }

        private void NEW_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.ActionNew();
        }

        private void EDIT_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.ActionEdit();
        }

        private void CANCEL_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.ActionCancel();
        }

        private void SAVE_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.ActionSave();
        }

        private void DELETE_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.ActionDelete();
        }

        private void LIST_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.List();
        }

        private void CLOSE_Click(object sender, EventArgs e)
        {
            if (module != null)
                module.Close();
        }

        private void PERMISION_Click(object sender, EventArgs e)
        {

        } 
        #endregion
    }
}
